<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆</title>
    <script src="../jq/jquery-1.11.3.js"></script>
    <script src="../jq/jquery-3.2.1.js"></script>
</head>
<body>
    <form id="login-form">
        <div>欢迎登陆</div>
        <div>username:</div>
        <div><input name="username"></div>
        <div>password:</div>
        <div><input name="pwd"></div>
        <div><input id="login-btn" type="button" value="登陆"></div>
    </form>
</body>
    <script>
        $("#login-btn").click(function () {
            var url = "../user/login.do";
            var data = $("#login-form").serialize();

            $.ajax({
                "url" : url,
                "data" : data,
                "type" : "POST",
                "dataType" : "JSON",
                "success" : function (json) {
                    if(json.state == 200){
                        alert("登录成功");
                    }else{
                        alert(json.message);
                    }
                }
            })
        });
    </script>
</html>